package bitWork;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: tao
 * Date: 2023-12-02
 * Time: 13:13
 */

public class Work1 {
    public static void main(String[] args) {
        Object locker = new Object();
        Thread c = new Thread(() -> {
            System.out.println("c");
        });
        Thread a = new Thread(() -> {
            synchronized (locker) {
                try {
                    locker.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("a");
            }
        });
        Thread b = new Thread(() -> {
            try {
                c.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            synchronized (locker) {
                System.out.println("b");
                locker.notify();
            }
        });
        a.start();
        b.start();
        c.start();
    }
}
